﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

/// <summary>
/// Summary description for SiteGlobals
/// </summary>
public class SiteGlobals
{
    private SiteGlobals() { }
    public static string BaseUrl
    {
        get
        {
            //return HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority + HttpContext.Current.Request.ApplicationPath.TrimEnd('/') + '/';
            string orginalUrl = HttpContext.Current.Request.Url.AbsoluteUri;
            if (HttpContext.Current.Request.Url.Query.Length > 0)
                orginalUrl = orginalUrl.Replace(HttpContext.Current.Request.Url.Query, string.Empty);

            return orginalUrl.Replace(HttpContext.Current.Request.Url.AbsolutePath, string.Empty) + ((HttpContext.Current.Request.ApplicationPath == "/" ? "" : HttpContext.Current.Request.ApplicationPath)) + '/';
        }
    }
    public static string ApplicationPath
    {
        get
        {
            return ((HttpContext.Current.Request.ApplicationPath == "/" ? "" : HttpContext.Current.Request.ApplicationPath));
        }
    }

    public static string AdminEmail
    {
        get
        {
            return System.Configuration.ConfigurationManager.AppSettings["AdminEmail"];
        }
    }
    public static string GoogleApiKey
    {
        get
        {
            return System.Configuration.ConfigurationManager.AppSettings["googleApiKey"];
        }
    }
    public static string MailChimpNewsletterListID
    {
        get
        {
            return ConfigurationManager.AppSettings["MailChimpNewsletterListID"];
        }
    }
    public static Exception LastGlobalError;
}
